package com.example.combwx.utils;

import android.content.SharedPreferences;

import com.example.combwx.App;

public class SpUtils {
    private static String name = "netcatch";
    private static String name1 = "user";

    public static void saveData(String key, String value) {
        SharedPreferences sp = App.getInstance().getApplicationContext()
                .getSharedPreferences(name, 0);
        sp.edit().putString(key, value).commit();
    }

    public static void accounData(String key, Boolean value) {
        SharedPreferences sp = App.getInstance().getApplicationContext()
                .getSharedPreferences(name1, 0);
        sp.edit().putBoolean(key, value).commit();
    }

    public static Boolean accounFatch() {
        SharedPreferences sp = App.getInstance().getApplicationContext()
                .getSharedPreferences(name1, 0);
        boolean aBoolean = sp.getBoolean("user", false);
        return aBoolean;
    }

    public static String readData(String key) {
        SharedPreferences sp = App.getInstance().getApplicationContext()
                .getSharedPreferences(name, 0);
        return sp.getString(key, "");
    }
}
